<?php
namespace app\index\model;

use think\Model;

class ProjectClasses extends Model
{
    public function children()
    {
        return $this->hasMany('Children', 'father_id');
    }

    public function projects(  )
    {
        return $this->hasManyThrough('Projects','Children','father_id','project_class_id','id');
    }

    public function test()
    {
       $a =  $this->get(2);
       $a = $a->projects()->order('project_class_id')->select();
       return $a;
    }
}
